//
//  OrderButton.swift
//  doubandiantai
//
//  Created by 王海申 on 2017/8/3.
//  Copyright © 2017年 王海申. All rights reserved.
//

import UIKit

class OrderButton: UIButton {

    var order:Int = 1;
    
    
    let order1:UIImage  = UIImage(named:"order1")!
    
    let order2:UIImage = UIImage(named:"order2")!
    let order3:UIImage = UIImage(named:"order3")!
    
    
    
    
    required init(coder aDecoder:NSCoder){
        
        super.init(coder:aDecoder)!
        
        self.addTarget(self, action: #selector(OrderButton.onClick), for: UIControlEvents.touchUpInside)
        
    }
    
    
    func onClick(){
        order += 1
        if order == 1 {
            self.setImage(order1, for: UIControlState.normal)
        } else  if order == 2 {
            self.setImage(order2, for: UIControlState.normal)
        } else if order == 3 {
            self.setImage(order3, for: UIControlState.normal)
        } else {
            self.setImage(order1, for: UIControlState.normal)

        }
        
    }

}
